// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/map/api/AreaMapApi'
import DelClass from '@api/map/model/DeleteAreaMapDeviceReq'
import state from '@admin/views/System/Map/MapPoint/store/state'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 删 —————————————————————————————— //

  async mapDel({ deviceId, deviceCategoryId }, TIP = '删除地图点位') {
    const objectType = state.MAP.OBJECT_TYPE[deviceCategoryId] || 1
    const DTO = CORE.grpcDTO(DelClass, { deviceId, objectType })
    await CORE.grpc(TIP, CLIENT, 'deleteAreaMapDeviceByDeviceId', DTO)
    return CORE.grpcOK(TIP)
  },
}
